<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="inc/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <%@ include file="inc/meta.jsp" %>
    <meta name="description" content="">
    <meta name="author" content="">
    <title>视频详情</title>
    <%@ include file="inc/css.jsp" %>
</head>
<body>

<div id="videos" class="wrapper">

    <%@ include file="inc/nav.jsp" %>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">视频列表</h1>
                <h4 style="margin-left: 10px;">——视频详情</h4>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <form class="form-horizontal">

                            <div class="form-group">
                                <label class="col-sm-2 control-label">视频名称:</label>

                                <div class="col-sm-8" style="padding-top: 6.5px;">
                                    <embed src="${video.url}" loop="true" width="700px" height="450px">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">视频名称:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    ${video.name}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">视频封面:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    <img src="${video.cover}" height="200px" width="200px"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">行业分类:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    ${video.videoType.name}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">视频简介:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    ${video.synopsis}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">投放记录:</label>

                                <div class="col-sm-6" style="padding-top: 6.5px;">
                                    <c:if test="${videoRecordList.size() == 0}">暂无</c:if>
                                    <c:forEach var="n" items="${videoRecordList}">
                                        <div style="border: 1px dashed #646464; padding: 10px; line-height: 30px;">
                                            操作时间：${n.createTimeStr}
                                            <br/>
                                            <c:if test="${n.startTimeStr != ''}">
                                                <c:if test="${n.sendType != 4}">
                                                    <c:if test="${n.regionNames != ''}">
                                                        投放区域：${n.regionNames}
                                                    </c:if>
                                                    <c:if test="${n.regionNames == ''}">
                                                        投放区域：不限
                                                    </c:if>
                                                    <br/>
                                                    投放时间：${n.startTimeStr}
                                                    <br/>
                                                    投放金额：${n.count * n.price}
                                                </c:if>
                                                <c:if test="${n.sendType == 4}">
                                                    开始时间：${n.startTimeStr}
                                                    <br/>
                                                    结束时间：${n.endTimeStr}
                                                </c:if>
                                                <br/>
                                                状<span style="visibility: hidden">隐藏</span>态：<c:if test="${n.recordStatus == 3}">投放中</c:if><c:if test="${n.recordStatus == 5}">已结束</c:if>
                                                <c:if test="${n.recordContent != ''}">
                                                    <br/>
                                                    <span style="visibility: hidden">隐藏字段：</span>${n.recordContent}
                                                </c:if>
                                            </c:if>
                                            <c:if test="${n.startTimeStr == ''}">
                                                状态：
                                                <c:if test="${n.isSend == 0}">
                                                    待审核
                                                </c:if>
                                                <c:if test="${n.isSend == 1}">
                                                    审核通过
                                                </c:if>
                                                <c:if test="${n.isSend == 2}">
                                                    审核失败
                                                </c:if>
                                            </c:if>
                                        </div>
                                    </c:forEach>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-12" style="text-align: center">
                                    <c:if test="${video.checkStatus == 0}">
                                        <a href="javascript:void(0)" class="btn btn-success" id="checkButtonToSuccess" onclick="_videoInfo.fn.changeStatus(${video.id},1)" role="button">审核成功</a>
                                        <a href="javascript:void(0)" class="btn btn-danger" id="checkButtonToFail" onclick="_videoInfo.fn.changeStatus(${video.id},2)" role="button">审核失败</a>
                                    </c:if>
                                    <a href="backend/video/index" class="btn btn-primary" role="button">返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!-- /.panel-body -->

                </div>
            </div>
        </div>

    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<div class="modal fade" id="checkModal" tabindex="-1" role="dialog" aria-labelledby="pwdModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">审核视频</h4>
            </div>
            <div class="modal-body" id="showDivBody">
                确定将该视频审核为成功？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" onclick="_videoInfo.fn.changeCheckStatus()" class="btn btn-primary">确定</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<%@ include file="inc/footer.jsp" %>

</body>

<script type="text/javascript">
    var _videoInfo = {
        v: {
            id: "_videoInfo",
            videoId: 0,
            status: 0
        },
        fn: {
            changeStatus: function (id, status) {
                _videoInfo.v.videoId = id;
                _videoInfo.v.status = status;
                if (status == 1) {
                    $('#showDivBody').html('确定将该视频审核为成功？');
                } else {
                    $('#showDivBody').html('确定将该视频审核为失败？');
                }
                $('#checkModal').modal("show");
            },
            changeCheckStatus: function () {
                $leoman.ajax("backend/video/changeCheckStatus", {
                    "videoId": _videoInfo.v.videoId,
                    "status": _videoInfo.v.status
                }, function (result) {
                    if (result == 1) {
                        $leoman.notify("操作成功", "success");
                        $('#checkButtonToSuccess').css("display", "none");
                        $('#checkButtonToFail').css("display", "none");
                        $('#checkModal').modal("hide");
                    } else {
                        $leoman.notify("操作失败", "error");
                    }
                });
            }
        }
    }
</script>

</html>